﻿using CommandService;

using Entity.SysEntity;
using Entity.ViewEntity.sys;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace BLL.Base
{
   public class LoginInfo
    {
        /// <summary>
        /// 登录用户基本信息
        /// </summary>
        /// <returns>用户信息模型</returns>
       public LoginUser UserInfo()
        {
            var userInfo = (LoginUser)HttpContext.Current.Session["user"];
            return userInfo != null ? userInfo : null;
        }
     
        /// <summary>
        /// 获取默认密码
        /// </summary>
        /// <returns></returns>
        public string getPwd()
        {
            var Pwd = (string)ConfigurationManager.AppSettings["defaultPwd"];
            return Pwd != null ? Pwd : null;
        }
       /// <summary>
       /// 当前登录人身份信息
       /// </summary>
       /// <returns></returns>
       public Dictionary<string,string> loginUser()
       {
           var uTable = (DataTable)HttpContext.Current.Session["user"];
           if (uTable == null || uTable.Rows.Count < 1)
           {
               return null;
           }
           Commands command = new Commands();
          return command.TableToDictionary(uTable).FirstOrDefault();
           
       }
    }
}
